package com.ruoyi.project.jiaqin.companyindustry.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.companyindustry.domain.CompanyIndustry;
import com.ruoyi.project.jiaqin.companyindustry.mapper.CompanyIndustryMapper;
import com.ruoyi.project.jiaqin.companyindustry.service.ICompanyIndustryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 企业行业Service业务层处理
 *
 * @author admin
 * @date 2021-01-26
 */
@Service
public class CompanyIndustryServiceImpl implements ICompanyIndustryService
{
    @Autowired
    private CompanyIndustryMapper companyIndustryMapper;

    /**
     * 查询企业行业
     *
     * @param id 企业行业ID
     * @return 企业行业
     */
    @Override
    public CompanyIndustry selectCompanyIndustryById(String id)
    {
        return companyIndustryMapper.selectCompanyIndustryById(id);
    }

    /**
     * 查询企业行业列表
     *
     * @param companyIndustry 企业行业
     * @return 企业行业
     */
    @Override
    public List<CompanyIndustry> selectCompanyIndustryList(CompanyIndustry companyIndustry)
    {
        return companyIndustryMapper.selectCompanyIndustryList(companyIndustry);
    }

    /**
     * 新增企业行业
     *
     * @param companyIndustry 企业行业
     * @return 结果
     */
    @Override
    public int insertCompanyIndustry(CompanyIndustry companyIndustry)
    {
        companyIndustry.setId(UUID.randomUUID().toString().replace("-",""));
        companyIndustry.setCreateAt(new Date());
        return companyIndustryMapper.insertCompanyIndustry(companyIndustry);
    }

    /**
     * 修改企业行业
     *
     * @param companyIndustry 企业行业
     * @return 结果
     */
    @Override
    public int updateCompanyIndustry(CompanyIndustry companyIndustry)
    {
        return companyIndustryMapper.updateCompanyIndustry(companyIndustry);
    }

    /**
     * 删除企业行业对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCompanyIndustryByIds(String ids)
    {
        return companyIndustryMapper.deleteCompanyIndustryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除企业行业信息
     *
     * @param id 企业行业ID
     * @return 结果
     */
    @Override
    public int deleteCompanyIndustryById(String id)
    {
        return companyIndustryMapper.deleteCompanyIndustryById(id);
    }

    @Override
    public List<CompanyIndustry> queryAll() {
        return companyIndustryMapper.queryAll();
    }
}
